home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / gui140.zip / GUI.DOC < prev    next >
Text File  |  1997-06-28  |  14KB  |  343 lines

  1. GUI Interface Programmers Library v. 1.40
  2. for QuickBasic 4.5
  3. Copyright (c) 1996 - 1997 by Tika Carr
  4. Rev. 10/12/1996, 12/12/1996, 06/28/1997
  5. ---------------------------------------------------------------------
  6.  
  7.                      **** To make the GUI Library ****
  8.  
  9. 1. Start QuickBasic 4.5 with the following parameters:
  10.  
  11.    QB /AH /L QB.QLB
  12.  
  13. 2. From the Run menu, select Make Library.
  14. 3. In the "Quick Library File Name" box, type in: GUI
  15.    Do NOT give an extension!
  16. 4. Click on "Make Library and Exit".
  17.  
  18. The following files will be found: GUI.LIB, GUI.QLB, GUI140.OBJ. You can 
  19. delete the GUI140.OBJ if you want, as its not needed.
  20. ---------------------------------------------------------------------
  21.  
  22.                      **** To Use the GUI Library ****
  23.  
  24. 1. Make sure you placed the GUI.LIB and GUI.QLB in a directory where
  25.    QuickBasic can find it. Usually its where you'll find QB.QLB.
  26.  
  27. 2. You must start QuickBasic with this command line:
  28.  
  29.    QB /ah /l gui.qlb
  30.  
  31.    You can also add in other command line options too, but at least
  32.    these MUST be present. A QBGUI.BAT file is included as well. Just
  33.    type QBGUI [other options] to start QB with the GUI library. This
  34.    assumes that QB.EXE is in your PATH or same directory as the batch
  35.    file.
  36.  
  37. 3. One of the very first things (besides DECLARE and REMark statements)
  38.    that you MUST put in your program is: '$INCLUDE: 'GUI.BI'
  39.    This sets up all the variables, and the screen mode, etc. for the
  40.    GUI library to work. From there, just start programming!
  41.  
  42.    There is a demo, GUIDEMO.BAS that you may look at to see how to
  43.    program using this library.
  44. ---------------------------------------------------------------------
  45.  
  46.                              **** OVERVIEW ****
  47.  
  48. The GUI Library is designed to help programmers create GUI programs with
  49. pop up windows, 3-D buttons and bars, check boxes, radio buttons and
  50. more. This library also has mouse support and works only in the 640 x
  51. 480 16-color screen 12 mode.
  52. ---------------------------------------------------------------------
  53.  
  54.                 **** PALETTE, COLORS & SCREEN MODE ****
  55.  
  56. In Screen 12, you can use up to 16 colors at a time, but you can change
  57. any of these to any of 262,144 different colors. The white% and black%
  58. are variables used to declare color 0 for black and color 15 for white.
  59. Changing the palette of color 0 and/or 15 will cause things like the
  60. buttons (drwbtn) to be off color and some things may not have the 3-D
  61. look as expected. You do NOT have to have SCREEN 12 in your program, as
  62. that is already defined for you in the GUI.BI file.
  63. ---------------------------------------------------------------------
  64.  
  65.                            **** REFERENCE GUIDE ****
  66.  
  67. Clearing the Screen:
  68. --------------------
  69.  
  70. CALL clrscrn (color)
  71. clrscrn color
  72.  
  73. This lets you clear the screen in any color 0 - 15.
  74. ---------------------------------------------------------------------
  75. Mouse Function:
  76. ---------------
  77.  
  78. CALL Mouse("mode")
  79. Mouse "mode"
  80.  
  81. Version 1.40 now lets you use words to set the mouse mode, instead of
  82. hard to remember numbers.
  83.  
  84. Modes are:
  85.  
  86. "init"    initialize mouse
  87. "show"    show mouse pointer on screen
  88. "hide"    hide mouse pointer (useful when drawing stuff)
  89. "get"     get mouse x, y and button information
  90.  
  91. Example Code:
  92.  
  93. Mouse 0  'Initialize Mouse (REQUIRED to be called once at start of
  94.          'program)
  95. Mouse 1  'Show Mouse pointer
  96. WHILE mb% = 0
  97.   Mouse 3
  98.   'Check to see if mouse is in certain boundaries when button is
  99. pressed.
  100.   IF mx% > x1 AND mx% < x2 AND my% > y1 AND my% < y2 AND mb% = 1 THEN
  101.     'Do what you want here when the mouse is "clicked" in certain
  102.     'boundaries
  103.   END IF
  104. WEND
  105. Mouse 2  'Hide the mouse (don't show mouse pointer)
  106.  
  107. Note that mx%, my% and mb% are global variables declared in GUI.BI.
  108. ---------------------------------------------------------------------
  109. Transparent Text Printing:
  110. --------------------------
  111.  
  112. CALL gprint ("Text", x, y, color)
  113. gprint "Text", x, y, color
  114.  
  115. This routine lets you print text on screen according to pixel location.
  116. Put the Text in quotes. X and Y are Pixel locations, not LOCATE
  117. locations, so you can go x up to 640 and Y up to 480. Do keep in mind
  118. that each character of text is 8 pixels by 8 pixels. color is from 0 to
  119. 15.
  120. ---------------------------------------------------------------------
  121. Buttons, Pop Up Menus, Frames, Check Boxes, Radio Buttons:
  122. ----------------------------------------------------------
  123.  
  124. CALL drwbtn (style, color, frame offset, frame color, x1, y1, x2, y2)
  125. drwbtn style, color, frame offset, frame color, x1, y1, x2, y2
  126.          |      |         |             |        |           |
  127.          --------         ---------------        -------------
  128.            Inside             Outside             Coordinates
  129.        of button/frame        of frame
  130.  
  131. x1, y1 is upper left; x2, y2 is lower right
  132.  
  133. 3-D Push Buttons:
  134. -----------------
  135. Styles 1 & 2 are for making those push buttons like "OK" or "Cancel",
  136. etc.
  137.  
  138. Style 1 - pushed in button
  139. Style 2 - is a normal button
  140.  
  141. drwbtn 1, 3, 0, 0, 3, 3, 55, 18    'Button is pushed (selected).
  142. drwbtn 2, 3, 0, 0, 75, 3, 121, 18  'Button is not pushed.
  143.  
  144. Note that the frame offset and color values are not used for push
  145. buttons.
  146.  
  147. Framed Pop-Ups:
  148. ---------------
  149. There are four styles of framed popup type windows that give a 3-D look:
  150.  
  151. drwbtn 3, 6, 10, 5, 3, 25, 103, 125     'Frame Style 3
  152. drwbtn 4, 3, 10, 2, 110, 25, 210, 125   'Frame Style 4
  153. drwbtn 5, 8, 10, 7, 220, 25, 320, 125   'Frame Style 5
  154. drwbtn 6, 11, 10, 10, 340, 25, 440, 125 'Frame Style 6
  155.  
  156. Style 3: Inlaid frame with embossed interior.
  157. Style 4: Embossed frame with inlaid interior.
  158. Style 5: Inlaid frame and interior.
  159. Style 6: Embossed frame and interior.
  160.  
  161. Note that we used an offset of 10 in the above 4 examples. This gives
  162. us a nice frame boarder. You can set this at any size in pixels that
  163. you wish.
  164.  
  165. Check Boxes:
  166. ------------
  167. Styles 7 and 8 create check boxes:
  168.  
  169. drwbtn 7, 4, 0, 0, 3, 135, 18, 150      'Plain Check Box
  170. drwbtn 8, 4, 0, 0, 23, 135, 38, 150     'Plain Check Box Checked
  171.  
  172. Note again that the frame values are not used.
  173.  
  174. Radio Buttons:
  175. --------------
  176. Radio buttons use the values a bit differently from the others. They
  177. are:
  178.  
  179. drwbtn style, color, radius, center mark color, x, y, nul, nul
  180.  
  181. Styles 9 and 10 provide you with the standard circular radio buttons:
  182.  
  183. CALL drwbtn(9, 9, 8, 0, 50, 143, 0, 0)     'Radio Button
  184. CALL drwbtn(10, 9, 8, 15, 70, 143, 0, 0)   'Radio Button On
  185.  
  186. The center mark color is the color of the dot that goes in the center
  187. of a selected radio button. Only the x and y coordinates are needed,
  188. and the other x and y parameters are 0 (not used).
  189. ---------------------------------------------------------------------
  190. Popup Input Box:
  191. ----------------
  192.  
  193. This lets you create a box that the user can input text in. See the
  194. GUIDEMO.BAS program for example usage.
  195.  
  196. CALL PopInp$ (Prompt$, Length%, x%, y%, bc%, tc%, fc%, ft%, cc%)
  197. PopInp$ Prompt$, Length%, x%, y%, bc%, tc%, fc%, ft%, cc%
  198.  
  199. Prompt$  what you'd like to ask the user
  200. Length   the maximum amount of characters you will allow in the input
  201.          field
  202. x1, y1   upper left corner coordinates
  203. bc       color of background of the popup box
  204. tc       text color
  205. fc       input field color
  206. ft       input field text color
  207. cc       cursor color
  208. ---------------------------------------------------------------------
  209. Pop Up Boxes:
  210. -------------
  211.  
  212. CALL PopUpBox (x%, y%, clrbox%, clrbdr%, clrtext%, TextArray$())
  213. PopUpBox x%, y%, clrbox%, clrbdr%, clrtext%, TextArray$()
  214.  
  215. This is a handy routine for a quick pop up box with an OK button in it.
  216. Here is an example of its use:
  217.  
  218. A$(1) = "This is a Test."
  219. A$(2) = "Of the PopUpBox Sub."
  220. PopUpBox 140, 100, 7, 8, 1, A$()
  221.  
  222. x, y    Upper left corner of the box. The other dimensions are
  223.         calculated automatically, based on the text you are going to put
  224.         into it.
  225. clrbox  color of the inside of the box (where the text is printed).
  226. clrbdr  color of the boarder around the box (uses drwbtn for 3D look).
  227. clrtext color of the text you put in the box.
  228. TextArray$() is where you pass the array that you have the text stored
  229. in. This MUST be an array! If its only 1 line, then just do:
  230. A$(1)="Your Line Here" and pass it to PopUpBox as A$(). ALWAYS pass your
  231. arrays with just parenthesis (). Do NOT put in any subscripts! For
  232. example:
  233.  
  234. PopUpBox 140, 100, 7, 8, 1, A$(2)      WRONG!
  235. PopUpBox 140, 100, 7, 8, 1, A$(MaxVal) WRONG!
  236. PopUpBox 140, 100, 7, 8, 1, A$         WRONG!
  237. PopUpBox 140, 100, 7, 8, 1, A$()       Right!
  238. ---------------------------------------------------------------------
  239. Creating and Maintaining Buttons:
  240. ---------------------------------
  241.  
  242. CALL button$ (x%, y%, t$, bc%, tc%, hl%, cp%, flag%)
  243. button$ (x%, y%, t$, bc%, tc%, hl%, cp%, flag%)
  244.  
  245. x, y   Upper left of button (the rest is automatically calculated)
  246. t$     The text to place in the button
  247. bc     color of the button
  248. tc     text color
  249. hl     color of the letter that will be highlighted (if none, use the
  250.        same color as tc).
  251. cp     position of the letter in the text that is to be highlighted (if
  252.        none, then just pass a 1 anyway).
  253. flag   This is 1 if it is NOT pushed and 0 if its pushed.
  254.  
  255. See in the GUIDEMO.BAS code where the following line is:
  256. '** Define a couple of buttons
  257.  
  258. This will show you how buttons are defined and used. There is a sort of
  259. handle system involved so that you can tell if a button is pushed or
  260. not. button$ is a function that returns the button location so that you
  261. can test if the mouse clicks on it. The pushbtn function will check to
  262. see if that button is pushed, and returns a value of 1 if is was pushed
  263. or a value of 0 if not. The GUIDEMO.BAS code shows how this works.
  264. ---------------------------------------------------------------------
  265. Title Bar:
  266. ----------
  267.  
  268. CALL TitleBar (t$, bc%, tc%)
  269. TitleBar t$, bc%, tc%
  270.  
  271. t$   The text you want to place in the title bar
  272. bc   The color of the bar
  273. tc   The color of the text
  274.  
  275. This function places a 3-D Title Bar at the top of the screen and
  276. automatically centers your text inside it.
  277. ---------------------------------------------------------------------
  278.  
  279.                            **** IN CLOSING ****
  280.  
  281. I know last revision (1.23, I believe) I said I would stop developing
  282. this library, but I came up with a couple more things, so here it all
  283. is, sources and all. Have fun. :) However, due to lack of time, etc. I
  284. can't promise any further development. I'm not able to provide technical
  285. support for this library. In other words, if you like it, use it and
  286. enjoy. If you find bugs, try to work around them the best you can, or
  287. work on the source code. I have done a lot of work on this library and
  288. its getting a bit too complicated to continue with. However, if you do
  289. improve the source code, please let me know so I too can update the
  290. library for myself. Cut and paste, or use as you like. Just adhere to
  291. the "LEGAL STUFF" below. Thanks. :)
  292.  
  293. Tika Carr
  294. t.carr@pobox.com
  295. http://www.pobox.com/~t.carr
  296. ---------------------------------------------------------------------
  297.  
  298.                           **** LEGAL STUFF ****
  299.  
  300. THIS PROGRAM IS RELEASED AS FREEWARE. I RESERVE THE COPYRIGHT TO THE
  301. PACKAGE AND ALL OF THE ROUTINES I HAVE WRITTEN. OTHER CONTRIBUTORS HOLD
  302. CLAIM TO THEIR OWN ROUTINES, AND HAVE AGREED TO ALLOW ME TO INCLUDE THEM
  303. IN THIS PACKAGE. IF YOU USE ANY OF THESE ROUTINES IN YOUR OWN CODE,
  304. PLEASE CREDIT THE AUTHOR IN AN ABOUT BOX OR OTHER WAY SO THAT USERS OF
  305. YOUR PROGRAM SEE WHO ALSO WROTE SOME OF THE CODE.
  306.  
  307. THIS LIBRARY AND SOURCE CODE IS DISTRIBUTED ON AN "AS IS" BASIS. THE
  308. AUTHOR(S) DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT
  309. NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR ANY
  310. PURPOSE. THE AUTHOR(S) ASSUME NO LIABILITY FOR DAMAGES, DIRECT OR
  311. CONSEQUENTIAL, WHICH MAY RESULT FROM USE OF THIS LIBRARY. YOUR RIGHTS
  312. MAY VARY DEPENDING ON YOUR STATE OR LOCATION SO THE ABOVE WARRANTIES MAY
  313. OR MAY NOT APPLY TO YOU. IN ANY EVENT, YOU AGREE NOT TO SEEK LITIGATION
  314. AGAINST THE AUTHOR(S) FOR ANY REASON. IF THIS LIBRARY WILL NOT SUIT YOUR
  315. NEEDS OR YOU FIND IT DISRUPTIVE, THEN SIMPLY DON'T USE IT. NO
  316. COMPENSATION WILL BE GIVEN BY THE AUTHOR(S).
  317. ---------------------------------------------------------------------
  318.  
  319.                           **** LICENSE OF USE ****
  320.  
  321. This code is usable by anyone who wishes, as long as they give credit to
  322. the proper people in their program code (see credits list) and in the on-
  323. screen of the finished product (ie. in an "About" menu).  The code in
  324. this library is only for Freeware, Shareware, personal or hobby use, and
  325. NOT for commercial use. Commercial developers, including CD-ROM
  326. shareware/collection houses, etc. must contact me to make arrangements
  327. for use of any of these routines.
  328. ---------------------------------------------------------------------
  329.  
  330.                         **** CREDITS ****
  331.  
  332. GUI Library concept, include file, documentation, etc. were all written
  333. by Tika Carr. All functions written by Tika Carr except the gprint
  334. routine, which was written by Douglas Lusher. This routine has been
  335. placed in the public domain and is free for anyone's use (so I used it
  336. in my library :)
  337.  
  338.            Microsoft QuickBasic is a trademark of Microsoft Corp.
  339.  
  340.  
  341.  
  342.  
  343.